Skip to content

Conversation

Alex4386
Copy link

@Alex4386 Alex4386 commented Mar 28, 2025

Abstract

This PR adds support for redoc's x-tagGroups (Ref), which is supported by Scalar (Reference)

Example

new Elysia()
  .use(swagger({
    path: '/docs',
    documentation: {
      tags: [
        {
           name: 'two-factor',
           description: 'Allow users to manage their 2FA config'
        }, {
           name: 'password',
           description: 'User actions for changing their own password'
        }
      ],
      'x-tagGroups': [
        {
          name: 'user',
          tags: ['two-factor', 'password']
        }
      ]
    }
  })

The example code will generate Scalar UI like the following:
image

Summary by CodeRabbit

  • New Features
    • API reference now supports tag groups, allowing you to organize endpoints into labeled sections for clearer navigation.
    • Configuration accepts a dedicated documentation object, making setup more consistent and enabling support for custom fields like tag groups (x-tagGroups).

@Alex4386 Alex4386 closed this Sep 25, 2025
@Alex4386 Alex4386 force-pushed the feature/add-x-tagGroups branch from 62875de to 070919e Compare September 25, 2025 05:12
@Alex4386 Alex4386 reopened this Sep 25, 2025
Copy link

coderabbitai bot commented Sep 25, 2025

Walkthrough

Type updates introduced a new ElysiaSwaggerDocumentation interface extending Partial<OpenAPIV3.Document> with exclusions and optional x-tagGroups. ElysiaOpenAPIConfig.documentation now uses this type. TagGroup was added to imports from @scalar/types.

Changes

Cohort / File(s) Summary
Types & Public API Updates
src/types.ts
Added TagGroup import; introduced ElysiaSwaggerDocumentation interface (Partial<OpenAPIV3.Document> with exclusions plus optional x-tagGroups: TagGroup[]); updated ElysiaOpenAPIConfig.documentation to use the new type instead of inline Omit.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I nudge the types with twitching nose,
New tags in groups, a tidy pose.
Documentation hops in line,
Interfaces now clean and fine.
With gentle thumps upon the ground—
“Typed and tagged!” I cheerfully sound. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly states the primary change of adding support for the x-tagGroups extension in Scalar Swagger document generation, aligning directly with the PR’s objective to expose and configure this OpenAPI feature. It is concise, specific, and free of extraneous details.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 070919e and ec8e17c.

📒 Files selected for processing (1)
  • src/types.ts (3 hunks)
🔇 Additional comments (1)
src/types.ts (1)

213-222: Nice addition: typed x-tagGroups support

Defining ElysiaSwaggerDocumentation once and tightening 'x-tagGroups' to TagGroup[] removes repetition while giving consumers proper IntelliSense when configuring Scalar grouping. Looks great.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant